package com.china08.yxyapi.entity.mg.res;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;

/**
 * 总模版(用于解析 questionBody)
 * 
 * @author tyw
 *
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JacksonXmlRootElement(localName = "question")
public class AllTemplate {
    @JacksonXmlProperty(isAttribute = true)
    public String version = "1.0";
    @JacksonXmlProperty(isAttribute = true)
    public String type = "";
    @JacksonXmlProperty
    public Sub sub = new Sub();

    @JacksonXmlRootElement(localName = "sub")
    public static class Sub {
        @JacksonXmlProperty(isAttribute = true)
        public String type = "";

        @JacksonXmlProperty
        public Stem stem = new Stem();
        @JacksonXmlElementWrapper(useWrapping = false)
        public List<Branch> branch = new ArrayList<AllTemplate.Branch>();
        @JacksonXmlElementWrapper(useWrapping = false)
        public List<Answer> answer = new ArrayList<AllTemplate.Answer>();
        @JacksonXmlProperty // 分析
        public Analysis analysis = new Analysis();
        @JacksonXmlProperty // 点评
        public Comment comment = new Comment();
        @JacksonXmlProperty // 解答
        public Solution solution = new Solution();

        // public Sub() {
        // branch = new ArrayList<AllTemplate.Branch>();
        // branch.add(new Branch());
        // branch.add(new Branch());
        // branch.add(new Branch());
        // branch.add(new Branch());
        // }

        // getter setter

        public Solution getSolution() {
            return solution;
        }

        public void setSolution(Solution solution) {
            this.solution = solution;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public Stem getStem() {
            return stem;
        }

        public void setStem(Stem stem) {
            this.stem = stem;
        }

        public Analysis getAnalysis() {
            return analysis;
        }

        public void setAnalysis(Analysis analysis) {
            this.analysis = analysis;
        }

        public Comment getComment() {
            return comment;
        }

        public void setComment(Comment comment) {
            this.comment = comment;
        }

        public List<Branch> getBranch() {
            return branch;
        }

        public void setBranch(List<Branch> branch) {
            this.branch = branch;
        }

        public List<Answer> getAnswer() {
            return answer;
        }

        public void setAnswer(List<Answer> answer) {
            this.answer = answer;
        }

    }

    @JacksonXmlRootElement(localName = "stem")
    public static class Stem {
        @JacksonXmlProperty(isAttribute = true)
        public Integer blanknum = 0;
        @JacksonXmlProperty(isAttribute = true)
        public Integer branchnum = 0;
        @JacksonXmlCData
        @JacksonXmlText
        public String body = "题干";

        public Integer getBlanknum() {
            return blanknum;
        }

        public void setBlanknum(Integer blanknum) {
            this.blanknum = blanknum;
        }

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }

        public Integer getBranchnum() {
            return branchnum;
        }

        public void setBranchnum(Integer branchnum) {
            this.branchnum = branchnum;
        }
    }

    @JacksonXmlRootElement(localName = "branch")
    public static class Branch {
        @JacksonXmlProperty(isAttribute = true)
        public String no = "";
        @JacksonXmlCData
        @JacksonXmlText
        public String body = "选项..";

        public String getNo() {
            return no;
        }

        public void setNo(String no) {
            this.no = no;
        }

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }

    }

    @JacksonXmlRootElement(localName = "answer")
    public static class Answer {
        @JacksonXmlProperty(isAttribute = true)
        public String no = "";
        @JacksonXmlCData
        @JacksonXmlText
        public String body = "答案";

        public String getNo() {
            return no;
        }

        public void setNo(String no) {
            this.no = no;
        }

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }
    }

    @JacksonXmlRootElement(localName = "analysis")
    public static class Analysis {
        @JacksonXmlCData
        @JacksonXmlText
        public String body = "解析";

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }
    }

    @JacksonXmlRootElement(localName = "comment")
    public static class Comment {
        @JacksonXmlCData
        @JacksonXmlText
        public String body = "详细解析";

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }

    }

    @JacksonXmlRootElement(localName = "solution")
    public static class Solution {
        @JacksonXmlCData
        @JacksonXmlText
        public String body = "解答";

        public String getBody() {
            return body;
        }

        public void setBody(String body) {
            this.body = body;
        }

    }

    // getter setter
    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Sub getSub() {
        return sub;
    }

    public void setSub(Sub sub) {
        this.sub = sub;
    }

}
